package com.wmapp.domain;

import org.springframework.util.StringUtils;

import com.wmapp.utils.Pserver;
import com.wmapp.utils.SimpleStringUtils;

public class LoginInfo {
	private String username;
	private String mcuName;
	private String mcuIP;
	private String accesslevel;//"Conference" or "System"
	private String grouplimit="false";//"true" or "false"
	private String group;
	
	private String managerprotocol;
	private String managerport;
	private String managername;
	
	private String localUsername;
	private String localAccesslevel;
	private String localGrouplimit;
	private String localGroup;
	
	private String h264definition;//MCU H264 definition
    private String maxPortNum;
	
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getMcuName() {
		return mcuName;
	}

	public void setMcuName(String mcuName) {
		this.mcuName = mcuName;
	}

	public String getMcuIP() {
		return mcuIP;
	}

	public void setMcuIP(String mcuIP) {
		this.mcuIP = mcuIP;
	}

	public String getLocalUsername() {
		return localUsername;
	}

	public void setLocalUsername(String localUsername) {
		this.localUsername = localUsername;
	}

	public String getAccesslevel() {
		return accesslevel;
	}

	public void setAccesslevel(String accesslevel) {
		this.accesslevel = accesslevel;
	}

	public String getGrouplimit() {
		return grouplimit;
	}

	public void setGrouplimit(String grouplimit) {
		this.grouplimit = grouplimit;
	}

	public String getGroup() {
		return group;
	}

	public void setGroup(String group) {
		this.group = group;
	}

	public String getLocalAccesslevel() {
		return localAccesslevel;
	}

	public void setLocalAccesslevel(String localAccesslevel) {
		this.localAccesslevel = localAccesslevel;
	}

	public String getLocalGrouplimit() {
		return localGrouplimit;
	}

	public void setLocalGrouplimit(String localGrouplimit) {
		this.localGrouplimit = localGrouplimit;
	}

	public String getLocalGroup() {
		return localGroup;
	}

	public void setLocalGroup(String localGroup) {
		this.localGroup = localGroup;
	}

	public String getManagerprotocol() {
		return managerprotocol;
	}

	public void setManagerprotocol(String managerprotocol) {
		this.managerprotocol = managerprotocol;
	}

	public String getManagerport() {
		return managerport;
	}

	public void setManagerport(String managerport) {
		this.managerport = managerport;
	}

	public String getManagername() {
		return managername;
	}

	public void setManagername(String managername) {
		this.managername = managername;
	}
	
	public boolean isLocal(){
		//return mcuName!=null&&mcuName.equals("local");
        return mcuIP!=null && mcuIP.equals("127.0.0.1");
	}
	
	public String getManagerURL() {
		if (isLocal()) {
			return Pserver.getInstance().getContextPath();
		} else {
			return SimpleStringUtils.join(
					StringUtils.hasText(managerprotocol) ? managerprotocol
							: MCU.DEFAULT_MANAGER_PROTOCOL, "://", mcuIP, ":",
					StringUtils.hasText(managerport) ? managerport
							: MCU.DEFAULT_MANAGER_PORT,
					StringUtils.hasText(managername) ? "/"+managername
							: MCU.DEFAULT_MANAGER_NAME);
		}
	}

	public String getH264definition() {
		return h264definition;
	}

	public void setH264definition(String h264definition) {
		this.h264definition = h264definition;
	}

    public String getMaxPortNum() {
		return maxPortNum;
	}

	public void setMaxPortNum(String maxPortNum) {
		this.maxPortNum = maxPortNum;
	}
	
}
